package com.qyhl.webtv.module_news.news.picturenews;


import com.qyhl.webtv.commonlib.entity.news.PictureBean;

/**
 * Created by qyhl on 2017/11/29.
 */

public class PictureNewsPresenter implements PictureNewsContract.PictureNewsPresenter {
    private PictureNewsActivity mView;
    private PictureNewsModel mModel;

    public PictureNewsPresenter(PictureNewsActivity mView) {
        this.mView = mView;
        this.mModel = new PictureNewsModel(this);
    }

    @Override
    public void getDetail(String newsId) {
        mModel.getDetail(newsId);
    }

    @Override
    public void count(String newsId) {
        mModel.count(newsId);
    }

    @Override
    public void collect(String newsId) {
        mModel.collect(newsId);
    }

    @Override
    public void cancelCollect(String newsId) {
        mModel.cancelCollect(newsId);
    }

    @Override
    public void setDetail(PictureBean bean) {
        mView.setDetail(bean);
    }

    @Override
    public void setError(int code, String msg) {
        if (code == 0) {
            mView.setNetError(msg);
        } else if (code == 1) {
            mView.setError(msg);
        } else {
            mView.setEmpty(msg);
        }
    }

    @Override
    public void collectSuccess(String msg) {
        mView.collectSuccess(msg);
    }

    @Override
    public void collectError(String msg) {
        mView.collectError(msg);
    }

    @Override
    public void cancelCollectSuccess() {
        mView.cancelCollectSuccess();
    }

    @Override
    public void cancelCollectError(String msg) {
        mView.cancelCollectError(msg);
    }

    @Override
    public void cancelCollect() {
        mView.cancelCollect();
    }
}
